package com.hua.server.oauth.entity;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.Set;

/**
 * 权限实体表
 *
 * @author 华云龙
 * @date 2019-5-28
 */
@Entity
@Table(name = "tb_permission")
@Getter
@Setter
public class Permission extends BaseIDEntity {

    @Column(name = "parent_id", length = 28)
    private Integer parentId;

    @Column(name = "name", length = 64)
    private String name;

    @Column(name = "enname", length = 64)
    private String enName;

    @Column(name = "url", length = 128)
    private String url;

    @Column(name = "description", length = 128)
    private String description;

    @Column(name = "created")
    private LocalDateTime created;

    @Column(name = "updated")
    private LocalDateTime updated;

    @ManyToMany(mappedBy = "permissions", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private Set<Role> roles;
}
